﻿package mortal.game.view.copy.singleTowerCopy2.item
{
    import Message.DB.Tables.*;
    import com.gengine.resource.*;
    import com.mui.controls.*;
    import com.mui.core.*;
    import flash.utils.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;
    import mortal.game.view.common.item.*;
    import mortal.game.view.copy.singleTowerCopy2.data.*;

    public class SingleTowerLeftPanel extends GSprite
    {
        protected var _bg:GImageBitmap;
        protected var _itmeList:CellsGridSprite;
        protected var _passTitle:GBitmap;
        protected var _passTip:GBitmap;
        protected var _selLvTxt:BitmapNumberText;
        protected var _rwLvDes:GBitmap;
        protected var _rwLvTxt:BitmapNumberText;
        protected var _recomPower:GImageBitmap;
        protected var _rPowerTxt:BitmapNumberText;
        private var _obj:Object;

        public function SingleTowerLeftPanel()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            LoaderHelp.addResCallBack(ResFileConst.sigleTowerCopy, this.onShow);
            return;
        }// end function

        private function onShow() : void
        {
            this._bg = UIFactory.gImageBitmap(ImagesConst.SingleTowerCopyLeftBg, 0, 0, this);
            this._itmeList = UIFactory.getUICompoment(CellsGridSprite);
            this._itmeList.colNum = 6;
            this._itmeList.vCellWid = 45;
            this._itmeList.hCellWid = 100;
            this._itmeList.genCellFun = UIFactory.getUICompoment;
            this._itmeList.genCells(6, BaseItem);
            this._itmeList.x = 69;
            this._itmeList.y = 481;
            this.addChild(this._itmeList);
            this._passTitle = UIFactory.gBitmap(ImagesConst.SigleTowerCopyFloorDes, 121, 31, this);
            this._passTip = UIFactory.gBitmap(ImagesConst.SigleTowerCopyPassTip, 126, 99, this);
            this._selLvTxt = UIFactory.bitmapNumberText(208, 37, "OpenNewSerSevNum.png", 38, 43, -10, this, 9, 1);
            this._selLvTxt.text = "20";
            this._rwLvDes = UIFactory.gBitmap(ImagesConst.SigleTowerCopyRwLvDes, 98, 451, this);
            this._rwLvTxt = UIFactory.bitmapNumberText(135, 448, "WorldBossNum.png", 25, 25, -12, this, 9, 1);
            this._rwLvTxt.text = "20";
            this._recomPower = UIFactory.gImageBitmap(ImagesConst.ChallengeNewSugCombatBg, 99, 421, this);
            this._rPowerTxt = UIFactory.bitmapNumberText(179, 424, "SignUpNum2.png", 22, 23, -6, this, 13, 0);
            this._rPowerTxt.text = "50000";
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            LoaderHelp.removeResEvent(ResFileConst.sigleTowerCopy, this.onShow);
            this._bg = null;
            this._itmeList = null;
            this._passTitle = null;
            this._passTip = null;
            this._selLvTxt = null;
            this._rwLvDes = null;
            this._rwLvTxt = null;
            this._recomPower = null;
            this._rPowerTxt = null;
            super.disposeImpl(param1);
            return;
        }// end function

        public function updateRwInfo(param1:Object) : void
        {
            if (param1 == null)
            {
                return;
            }
            var _loc_2:* = param1.code;
            var _loc_3:* = param1.lv;
            var _loc_4:Array = null;
            if (_loc_4 == null)
            {
                _loc_4 = SingleTowerCopyUtil.getComRwArrByCodeAndLv(_loc_2, _loc_3);
            }
            this._itmeList.updateAll(_loc_4, BaseItem, "itemData", false);
            this._itmeList.x = (410 - _loc_4.length * 45 + 3) / 2;
            var _loc_5:* = SingleTowerCopyUtil.getTotalLvByCode(_loc_2);
            var _loc_6:* = Cache.instance.copy.groupTower.singleGanInfo.passMaxLevel;
            var _loc_7:* = int(_loc_6[_loc_2]);
            this._selLvTxt.text = "" + _loc_3;
            this._rwLvTxt.text = "" + _loc_3;
            if (_loc_3 <= _loc_7)
            {
                this._passTip.bitmapData = GlobalClass.getBitmapData(ImagesConst.SigleTowerCopyPassTip);
            }
            else
            {
                this._passTip.bitmapData = GlobalClass.getBitmapData(ImagesConst.SigleTowerCopyNotPassTip);
            }
            var _loc_8:* = TowerCopyConfig.instance.getInfoByID(_loc_2, _loc_3);
            if (_loc_8)
            {
                this._rPowerTxt.text = "" + _loc_8.advanceCombat;
            }
            return;
        }// end function

    }
}
